//
//  DoctorCell.m
//  kuaiyi
//
//  Created by vn on 16/7/6.
//  Copyright © 2016年 Alphts. All rights reserved.
//

#import "DoctorCell.h"


@interface DoctorCell()

//病人
@property(nonatomic,strong)UILabel * patient_lb;
//病
@property(nonatomic,strong)UILabel * bing_lb;
//医生
@property(nonatomic,strong)UILabel * doctor_lb;
//就诊时间
@property(nonatomic,strong)UILabel * time_lb;
//医院
@property(nonatomic,strong)UILabel * hospital_lb;
//审核
@property(nonatomic,strong)UIButton * audit_bt;
//分割线
@property(nonatomic,strong)UIView * lineView;


@end

@implementation DoctorCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
      
        [self setUpUI];
        
        
    }
    
    return self;
    
    
}

#pragma mark -- 控件赋值
- (void)setDoctroModel:(SEDoctorModel *)doctroModel{
    
    _doctroModel = doctroModel;
    
    self.patient_lb.text = doctroModel.Pname;
    self.doctor_lb.text = doctroModel.Dname;
    self.time_lb.text = doctroModel.Time;
    self.hospital_lb.text = doctroModel.Hname;
    [self.audit_bt setTitle:doctroModel.Astr forState:UIControlStateNormal];
    self.bing_lb.text = doctroModel.bing;
    
}



#pragma mark -- 布局子控件
- (void)layoutSubviews{
    [super layoutSubviews];
    
    [self.audit_bt setBackgroundColor:kThemeColor];
    [self.patient_lb mas_makeConstraints:^(MASConstraintMaker *make) {
        
        
        make.bottom.equalTo(self.lineView.top).offset(-15);
        make.left.offset(5);
        
    }];
    
    
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        
    
        make.centerY.mas_equalTo(self.mas_centerY);
        make.height.offset(2);
        make.right.equalTo(self.audit_bt.mas_left).offset(2);
        make.left.offset(5);
        
        
    }];
  
    
    [self.doctor_lb mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.top.equalTo(self.lineView.bottom).offset(15);
        make.left.offset(5);
        
    }];
    
    
   [self.time_lb mas_makeConstraints:^(MASConstraintMaker *make) {
      
       make.bottom.equalTo(self.patient_lb.bottom);
       make.right.equalTo(self.audit_bt.mas_left).offset(-20);
       
       
       
   }];
    
   [self.hospital_lb mas_makeConstraints:^(MASConstraintMaker *make) {
      
       
       make.top.equalTo(self.doctor_lb.top);
       make.right.equalTo(self.time_lb.mas_right);
       
       
   }];
   
    [self.bing_lb mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.bottom.equalTo(self.patient_lb.bottom);
        make.left.equalTo(self.patient_lb.right).offset(10);
        
        
    }];
    
    
    
    [self.audit_bt mas_makeConstraints:^(MASConstraintMaker *make) {
       
        make.centerY.equalTo(self.centerY);
        make.width.offset(60);
        make.height.offset(60);
        make.right.mas_offset(-30);
        
        
        
    }];
    
    
    
}



#pragma mark -- 初始化子空间
- (void)setUpUI{
    
    [self addSubview:self.patient_lb];
    [self addSubview:self.doctor_lb];
    [self addSubview:self.time_lb];
    [self addSubview:self.hospital_lb];
    [self addSubview:self.audit_bt];
    [self addSubview:self.lineView];
    [self addSubview:self.bing_lb];
}

#pragma mark -- lazy控件
- (UILabel *)patient_lb{
    
    if (_patient_lb == nil) {
        
        _patient_lb = [[UILabel alloc]init];
        _patient_lb.font = [UIFont systemFontOfSize:14];
        [_patient_lb sizeToFit];
    }
    return _patient_lb;
    
}

- (UILabel *)doctor_lb{
    
    if (_doctor_lb == nil) {
        
         _doctor_lb = [[UILabel alloc]init];
        _doctor_lb.font = [UIFont systemFontOfSize:14];
        [_doctor_lb sizeToFit];
    }

    return _doctor_lb;
}

- (UILabel *)time_lb{
    
    if (_time_lb == nil) {
        _time_lb = [[UILabel alloc]init];
        _time_lb.font = [UIFont systemFontOfSize:14];
        [_time_lb sizeToFit];
    }
    
    return _time_lb;
    
}

- (UILabel *)hospital_lb{
    
    if (_hospital_lb == nil) {
        _hospital_lb = [[UILabel alloc]init];
        _hospital_lb.font = [UIFont systemFontOfSize:14];
        [_hospital_lb sizeToFit];
    }
    
    return _hospital_lb;
}

- (UIButton *)audit_bt{
    
    if (_audit_bt == nil) {
        
        _audit_bt = [[UIButton alloc]initWithFrame:CGRectZero];
        
        _audit_bt.userInteractionEnabled = NO;
       
        
       _audit_bt.layer.cornerRadius = 30;
        _audit_bt.titleLabel.font = [UIFont systemFontOfSize:14];
        [_audit_bt setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        
    }
    
    return _audit_bt;
}

- (UIView *)lineView{
    
    if (_lineView == nil) {
        
       _lineView = [[UIView alloc]initWithFrame:CGRectZero];
      
        _lineView.backgroundColor = [UIColor grayColor];
    
    }
    
    return _lineView;
}

- (UILabel *)bing_lb{
    
    if (_bing_lb == nil) {
        
        _bing_lb = [[UILabel alloc]init];
        _bing_lb.font = [UIFont systemFontOfSize:14];
        [_bing_lb sizeToFit];
        
    }
    return _bing_lb;
}

@end
